import pymongo
from rest_framework.views import APIView
from pymongo import MongoClient


class MongoView(object):

    def __init__(self):
        self.a = MongoClient(host='127.0.0.1', port=27017)
        self.db = self.a['tinai']
        self.table = self.db['cate']

    def find_one(self,value):

        data = self.table.find_one(value)
        return data